<template>
  <div class="app-container" style="padding: 0;">
    <el-form label-position="right" disabled label-width="auto">
      <el-form-item>
        <div style="width: 100%"><h1>{{obj.title}}</h1></div>
        <div style="width: 100%;color: #888;">发布于 {{obj.updateTime}}</div>
      </el-form-item>
      <el-form-item>
        <div v-html="obj.content"></div>
      </el-form-item>
    </el-form>
  </div>
</template>
<script setup>
import {ref, watch} from 'vue'
import {doGet} from "@/config/http";
import {svc} from "@/config/common"

let obj = ref({})

const props = defineProps({
  announceId: {
    required: true,
    type: String,
  },
})

const getData = async id => {
  // 这里调用接口
  obj.value = await doGet(svc, '/announce/' + id, {}, true)
}

watch(() => props.announceId, async val => {
  await getData(val)
},{immediate:true})
</script>
